package spring.in.action.chapter_03;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import spring.in.action.chapter_03.qualifier.Cold;
import spring.in.action.chapter_03.qualifier.DessertConfig;
import spring.in.action.chapter_03.qualifier.Fruity;
import spring.in.action.chapter_03.qualifier.IDessert;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes =
{ DessertConfig.class })
public class DessertTest2
{
    @Autowired
    @Qualifier("cold")
    IDessert iDessert;

    @Autowired
    @Cold
    @Fruity
    IDessert iDessert2;

    @Test
    public void tesQualifier()
    {
        assertEquals(iDessert.getClass().getSimpleName(), "IceCream");
    }

    @Test
    public void tesCustom()
    {
        assertEquals(iDessert2.getClass().getSimpleName(), "Popsicle");
    }
}
